Object Collision Functions
Listed below are the Built-in Functions that can be used during the Player-instigated
"Collision Phase" of an Object. They are
assigned to an Object Type by entering their ID in that Type's entry in the Object Def File.
Some of these Functions can be used in combination with any Movement or Drawing Function,
some only some, and some are limited to only one combination. This is determined by
how the Functions affect the Object, and what types of "Extra Variables" each one requires.
Scripted Collision Functions may be used instead of the Built-in Functions, or in
addition to them. If both Built-in and
Scripted Collision Functions are used, the Built-in Function is processed first.
Scripted Collision Functions are called every time a Player Character moves, regardless
of whether any collision has actually happened, because these Functions perform the actual
collision test as well as determine what happens next if a collision has occured. For this
reason, for an accurate collision test, the Function must contain a Script Command that
either tests for collision between any of the selectable "Collision Box" types on a Player
Character and a Game Object, or manually tests the distance between a Player Character and a
Game Object.
For example, the _If(Object_Collide_Player) Script Command could be used to
test for Player "Attack" collision with an Object's "Hurt" area, to "damage" the Object by
using the appropriate Script Commands within that "If" Block. The same Function could also
use the same Command to test for Player "Hurt" collision with an Object's "Attack" area to
"damage" the player by using the appropriate Script Commands within that "if" block.
If a
collision is found, it is recommended that the "_StopCurrentFunc" Command be
used to prevent the Function from testing for other types of collision that could, for
example, cause "damage" to both the Player and the Object when that is not the desired
effect.
Index:
0 - _OCol_None
1 - _OCol_Item
2 - _OCol_PlaneSwitchH
3 - _OCol_PlaneSwitchV
4 - _OCol_Tiled
Descriptions:
0 - _OCol_None
This Function does absolutely nothing. It is used to exclude a Built-in Function.
1 - _OCol_Item
If the player's MainBounds collide with the Object's MainBounds, one of his
variables is increased by a given value if this increase will not excede the
given maximum, and the first sound in the Object's sound listing is played.
If an Object is listed in this Object's Object listing, the first Object in that
list is spawned.
The Object that runs this Function is automatically destroyed after collision.
Expected Values:
Sound List
0- Collision Sound
The sound to play when the Player has collided with the Object. This value is optional
Objects List
0- Replacement Object
The Object to spawn when this Object is destroyed. This value is optional
Constant lists List
0- List 0
0- Var ID
ID number of the Player Variable to affect upon collision. This value should be prefixed with a "P", and the "C", "c", "A", and "a" tags
may be used (Ex: User-created "Active Variable" 5 would be referenced as "Pa5">
1- Value
This value is added to the given Player Variable upon collision
2- Maximum
This value specifies the maximum value that can be applied to the given Player Variable by this Function. A value of 0 means "no maximum"
2 - _OCol_PlaneSwitchH
If the player's MainBounds collide with a horizontal area ranging from 32
pixels to the left of the object to 32 pixels to the right of it, and its
vertical center point, his "Player_Solid_Plane" variable will be changed, so that a
different Tile Plane will affect his level collision.
Expected Values:
Constant lists List
0- List 0
0- Up Switch
Tile Plane ID number to pass to "Player_Solid_Plane" when the Player is travelling to up (Y Velocity, not Path Velocity, is negative
1- Down Switch
Tile Plane ID number to pass to "Player_Solid_Plane" when the Player is travelling to down (Y Velocity, not Path Velocity, is negative
2- Path Flag
This value specifies whether or not the Player must be attached to a path for the change to take effect:
0- The change will take effect if the Player is in freespace or on a path
1- The change will only take effect if the Player is following a path
3 - _OCol_PlaneSwitchV
If the player's MainBounds collide with a horizontal area ranging from 32
pixels above the object to 32 pixels below it, and its horizontal center
point, his "Player_Solid_Plane" will be changed, so that a different Tile Plane will
affect his level collision.
Expected Values:
Constant lists List
0- List 0
0- Left Switch
Tile Plane ID number to pass to "Player_Solid_Plane" when the Player is travelling to the left (X Velocity, not Path Velocity, is negative
1- Right Switch
Tile Plane ID number to pass to "Player_Solid_Plane" when the Player is travelling to the right (X Velocity, not Path Velocity, is negative
2- Path Flag
This value specifies whether or not the Player must be attached to a path for the change to take effect:
0- The change will take effect if the Player is in freespace or on a path
1- The change will only take effect if the Player is following a path
4 - _OCol_Tiled
This Function causes the Player to react to Tile Map data stored within the Object's Object Variables as if it were a standard Tile Plane.
This map data can easily be obtained from within the Level Editor,
and its exact placement in the variable listing is adjustable.
This Function is primarily used in conjunction with ODraw_Tiled
to create a Tiled Path Object. If the Object is to move, the appropriate "ShovePlayer" Commands should be used as described.
Expected Values:
Extra Variables:
0- Plat_Start
This variable specifies the starting location of the Tile Map data within the "Extra Variables".
It is the ID number of the "Extra Variable" where the Map Width is listed, which is followed by Map Height, the Plane ID, and the Tile ID data itself.
[...]- Unused
Variables between "Plat_Start" and the variable whose ID is stored within "Plat_Start" are unused by this Function, and so can be used for anything.
[Plat_Start]+0- Width
[Plat_Start]+1- Height
This is the start of the Tile Map data; it begins at the "Extra Variable" whose ID is stored in "Plat_Start" (Ex: if the value of "Plat_Start" is "8", then "E8" will hold width, "E9" will hold height, etc).
These are the width and height (in tiles) of the Tile Map.
[Plat_Start]+2- Plane
For a Player to process collisions with this Object, his "Player_Solid_Plane" variable must be equal to this value.
[Plat_Start]+[...]- TileID
The Tile IDs that make up the Tile Map are listed at this point. There are width*height of these entries (Ex: if "width" is "5", and "height" is "10", then there are 50 of these entries)